function toFixed (num, s) {
  var times = Math.pow(10, s)
  num = num * times + 0.5
  num = parseInt(num) / times
  return num
}

var num = 1.3355

console.log(toFixed(num, 3))
